-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(optimizer): use getters to access plan base, with runtime convention checking #12980
Conversation
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
636d235
to
5c0d5f9
Compare
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #12980 +/- ##
==========================================
- Coverage 68.70% 68.63% -0.08%
==========================================
Files 1495 1495
Lines 251092 251102 +10
==========================================
- Hits 172521 172345 -176
- Misses 78571 78757 +186
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 22 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LSTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM.
|
||
/// The order property of the PlanNode's output, store an `&Order::any()` here will not affect | ||
/// correctness, but insert unnecessary sort in plan | ||
order: Order, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting order here is a little counter-intuitive, since our materialized view could have an order by property i.e. StreamMaterialize
theoretically could access its order
property, but now it would cause a panic. However, I don't have a better idea right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StreamMaterialize
theoretically could access itsorder
property, but now it would cause a panic.
Even though we now force a panic when accessing a bad field, all tests are passing. I'm also surprised that this doesn't seem to be a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Wow. So many conflicts. 🙁 |
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao [email protected]I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Reviewing these 3 files should be sufficient:
Towards a type-safer optimizer.
This PR makes all fields in
PlanBase
private and force the callers to access them by accessing methods with traits likeGenericPlanRef
,StreamPlanRef
, andBatchPlanRef
. There're several reasons for doing this:PlanBase
are actually copied from thecore
when constructing. Exposing the fields then the mutability may lead to inconsistency and confusion.Instructed by the reason 2, this PR introduces a enum
Extra
for the physical-specific fields. Accessing the fields with a mismatched convention will lead to runtime panic.risingwave/src/frontend/src/optimizer/plan_node/plan_base.rs
Lines 120 to 121 in 6266b96
risingwave/src/frontend/src/optimizer/plan_node/plan_base.rs
Lines 59 to 64 in 6266b96
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.